package cn.tedu.tw.whr.ref;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class App {
    public static void main(String[] args) throws Exception{
        Class<?> C = Class.forName("cn.tedu.tw.whr.ref.CustomerService");
        Class<?> U = Class.forName("cn.tedu.tw.whr.ref.UserService");
        Object customerService = C.newInstance();
        Object userService = U.newInstance();
        Field service = C.getDeclaredField("service");

        service.setAccessible(true);
        service.set(customerService,userService);

        Method printRandomString = C.getMethod("printRandomString");

        printRandomString.invoke(customerService);


    }
}
